const checkImageWH = (file) => {
  return new Promise(function(resolve, reject) {
    const filereader = new FileReader()
    filereader.onload = e => {
      const src = e.target.result
      const image = new Image()
      image.onload = function() {
        if (this.width && this.height) {
          const size = [this.width, this.height]
          resolve(size)
        } else {
          reject()
        }
      }
      image.onerror = reject
      image.src = src
    }
    filereader.readAsDataURL(file)
  })
}
export default checkImageWH
